{extend name="layout:default" /}

{block name="title"}考勤详情{/block}

{block name="content"}
<link href="https://cdn.bootcss.com/layer/2.2/skin/layer.css" rel="stylesheet">
<link rel="stylesheet" href="/css/sign.css">
<link rel="stylesheet" href="/css/tooltips.css">
<div class="row">

    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title">考勤详情</h3>
                <div class="box-tools">
                </div>
            </div>
            <a href="{:url('index')}" class="btn btn-info">返回</a>
            <form class="form-inline clearfix" method="get">
                <input type="hidden" value="{$Request.param.id}" id="uid">
                <input type="hidden" value="{$date}"  id="date">
                <div class="row " style="margin: 10px 10px 20px;">
                    <!--<div class="form-group">
                        <label for="date">签到时间：</label>
                        <input type="text" name="date" id="date" class="form-control" value="{$Request.param.date}" placeholder="签到">
                    </div>-->
                    <div class="form-group">
                        <label for="type">类型：</label>
                        <select name="status" class="form-control" id="type">
                            <option value="-1">不限</option>
                            <option value="1">正常</option>
                            <option value="2">迟到</option>
                            <option value="3">早退</option>
                        </select>
                    </div>
                    <input type="submit" class="btn btn-primary" value="查询">
                </div>
            </form>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding" style="margin-bottom: 50px;">
                <div style="width:300px;height:500px;" id="calendar"></div>
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /.box -->
    </div>
</div>
<textarea name="" hidden id="data" cols="30" rows="10">{$d}</textarea>

{/block}

{block name="js"}

<script src="https://cdn.bootcss.com/layer/2.2/layer.js"></script>
<script src="/js/calendar.js"></script>
<script src="/js/jquery.pure.tooltips.js"></script>
<script>
    let data = JSON.parse($('#data').val());
    // console.log(data);
        //ajax获取日历json数据
    // var signList=[{"type":2,"signDay":5},{"type":2,"signDay":7},{"type":2,"signDay":8},{"type":1,"signDay":10},{"type":3,"signDay":11}];
    calUtil.init(data);

    function status(obj, id) {
        let s = +($(obj).prop("checked"));
        /*if (s == 2) {
            $('input:checkbox').prop('checked', false);
            $(obj).prop('checked', true);
        }*/
        // console.log(s, id);
        layer.confirm('您确定要改变？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.post('/admin/evaluations/status', {id:id, status: s}, function (data) {
                if (data.status == 200) {
                    layer.msg(data.message, {icon: 1})
                } else {
                    layer.msg(data.message, {icon: 2})
                }
                setTimeout(function () {
                    window.location.href = window.location;
                }, 200)
            });
        }, function(){
        });
    }
    $.fn.datepicker.dates['cn'] = {
        days: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
        daysShort: ["日", "一", "二", "三", "四", "五", "六", "七"],
        daysMin: ["日", "一", "二", "三", "四", "五", "六", "七"],
        months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
        monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
        today: "今天",
        clear: "清除"
    };
    $('#date').datepicker({
        autoclose: true,
        language: 'cn'
    });

    $('.on').mouseover(function (e) {
       let id = $(this).data('id');
        var self = this;
       $.get('/admin/attendance/getContent?id='+id, function (data) {
           if (data.status == 200) {
               let status = '';
               switch (data.data.type) {
                   case 1:
                       status = '出勤';
                       break;
                   case 2:
                       status = '迟到';
                       break;
                   case 3:
                       status = '早退';
                       break;
               }
               let str = "签到时间："+ data.data.addtime + "("+status+")";
               $.pt({
                   target: self,
                   content: str
               });
           }
       });

    });
    /*function tips(obj) {
        $('#tooltips').click(function() {
            var self = this;
            $.pt({
                target: self,
                content: '好雨知时节， 当春乃发生。随风潜入夜， 润物细无声。。。'
            });
        });
        console.log(obj);
        $.pt({
            target: obj,
            content: "1212"
        })
    }*/
</script>
{/block}